package com.weaver.drools.common.utils;

import java.net.InetAddress;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;

public class SystemUtools {

	public static Map<String, String> SystemInfo(HttpServletRequest request) {
		Map<String, String> sysMap = new HashMap<>();
		try {
            InetAddress addr = InetAddress.getLocalHost();
            Properties props = System.getProperties();
            sysMap.put("ip", addr.getHostAddress().toString());
            sysMap.put("name", addr.getHostName().toString());
            sysMap.put("systemName", props.getProperty("os.name"));
            sysMap.put("systemUserName", props.getProperty("user.name"));
            sysMap.put("JavaVersion", "Java "+props.getProperty("java.version"));
            sysMap.put("tomcat", request.getServletContext().getServerInfo());
            sysMap.put("Redis", "3.2.1");
            sysMap.put("MongoDB", "3.4");
        } catch (Exception e) {
            e.printStackTrace();
        }
		return sysMap;
	}
}
